package com.thundersoft.beautifulmusic.entity;

import android.os.Build;

import androidx.annotation.RequiresApi;

import java.io.Serializable;
import java.util.Objects;

/**
 * 歌曲信息，保存歌曲的详细信息
 */

public class Song implements Serializable {
    private final long albumId;
    private final String name;
    private final String singer;
    private final String path;

    public Song(long albumId, String name, String singer, String path) {
        this.albumId = albumId;
        this.name = name;
        this.singer = singer;
        this.path = path;
    }

    public long getAlbumId() {
        return albumId;
    }

    public String getName() {
        return name;
    }

    public String getSinger() {
        return singer;
    }

    public String getPath() {
        return path;
    }


    @Override
    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Song song = (Song) o;
        return albumId == song.albumId &&
                Objects.equals(name, song.name) &&
                Objects.equals(singer, song.singer) &&
                Objects.equals(path, song.path);
    }

    @Override
    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    public int hashCode() {
        return Objects.hash(albumId, name, singer, path);
    }
}
